﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ETL.Common.Logging;
using ETL.DataAccess;

namespace ETL.Business.Handlers.ProjectScheduledResourceUsageHandler
{
    public class AddNewScheduledResourceUsage
    {
        private readonly ProjectScheduledResourceUsageRepository _projectTaskRepository;

        public AddNewScheduledResourceUsage(ProjectScheduledResourceUsageRepository projectTaskRepository)
        {
            _projectTaskRepository = projectTaskRepository;
        }
        public AddNewScheduledResourceUsage()
        {
            _projectTaskRepository = new ProjectScheduledResourceUsageRepository();
        }

        public virtual int Execute(string genTaskId, string userId, DateTime startDate, DateTime endDate)
        {
            int result = -1;
            try
            {
                result = _projectTaskRepository.AddNewScheduledResourceUsage(genTaskId, userId, startDate, endDate);
                return result;
            }
            catch (Exception ex)
            {
                LogService.Service.Error(ex);
                return -1;

            }

        }
    }
}
